package com.anbang.website.utils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * website系统相关基础工具类
 */
public class SystemLoginUtils {

	/**
	 * 取登录用户id
	 */
	public static Long getLoginUserId(HttpServletRequest request){
		//判断session是否失效，如失效需重新登录
		HttpSession session = request.getSession();
		
		return (Long)session.getAttribute("userId");//登录用户id  
	}	
	
	/**
	 * 取登录用户所属客户id
	 * 
	 * @param request
	 * @return
	 */
	public static Long getCustomerId(HttpServletRequest request){
		//判断session是否失效，如失效需重新登录
		HttpSession session = request.getSession();
		
		return (Long)session.getAttribute("customerid");//客户id
	}	
	
	/**
	 * 取业务联系人id
	 * 
	 * @param request
	 * @return
	 */
	public static Long getBusinesspersonId(HttpServletRequest request){
		//判断session是否失效，如失效需重新登录
		HttpSession session = request.getSession();
		
		return (Long)session.getAttribute("businesspersonid");//业务联系人id
	}	
}
